// 定义二级路由组件, 
import React from 'react';
import { Route, Switch, Redirect } from 'react-router-dom';
import { lazy, Suspense } from 'react';
import Loading from '@/components/Loading'
const Welcome = lazy(() => import('@/views/dashboard/welcome'))
const Userlist = lazy(() => import('@/views/dashboard/user/index'))
const Filmlist = lazy(() => import('@/views/dashboard/film/index'))
const Cinemalist = lazy(() => import('@/views/dashboard/cinema/index'))
const Collegelist = lazy(() => import('@/views/dashboard/college/index'))
const Admin = () => {
  return (
    <Suspense fallback={<Loading></Loading>}>
      <Switch>
        <Route path='/dashboard/welcome' component={Welcome}></Route>
        <Route path='/dashboard/user/index' component={Userlist}></Route>
        <Route path='/dashboard/film/index' component={Filmlist}></Route>
        <Route path='/dashboard/cinema/index' component={Cinemalist}></Route>
        <Route path='/dashboard/college/index' component={Collegelist}></Route>
        <Redirect from='/dashboard' to='/dashboard/welcome' exact></Redirect>
      </Switch>
    </Suspense>
  );
}

export default Admin;
